package com.bytedance.article.common.a.a;

import android.support.annotation.NonNull;
import android.text.TextUtils;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.LinkedList;

final class e extends com.bytedance.frameworks.core.thread.e {
    private final c a;

    e(com.bytedance.article.common.a.a.c arg1) {
        this.a = arg1;
    }

    public final void run() {
        LinkedList v2;
        LinkedList v1;
        try {
            c.a(this.a, System.currentTimeMillis());
            v1 = new LinkedList();
            v2 = c.e();
            synchronized (v2) {
                v1.addAll(c.e());
                c.e().clear();
            }
            if (v1.isEmpty()) {
                return;
            }

            JSONObject v2_1 = new JSONObject();
            JSONArray v3 = new JSONArray();
            while (!v1.isEmpty()) {
                Object v0_1 = v1.poll();
                if (TextUtils.isEmpty(((CharSequence) v0_1))) {
                    continue;
                }

                JSONObject v4 = new JSONObject();
                v4.put("stack", v0_1);
                v4.put("timestamp", System.currentTimeMillis());
                v4.put("event_type", "lag");
                v3.put(v4);
            }

            v2_1.put("data", v3);
            if (c.b(this.a) == null) {
                c.a(this.a, com.bytedance.framwork.core.monitor.c.j().l());
            }

            v2_1.put("header", c.b(this.a));
            c.a(this.a, "http://abn.snssdk.com/collect/", v2_1.toString());
        } catch (Throwable v0) {
//                label_19:
            v0.printStackTrace();
        }
    }

    @Override
    public void f(@NonNull Object o) {

    }
}

